from vtk import *
import sys

if len(sys.argv)<2:
	print "\n*** usage:",sys.argv[0]," [hierarchy.xml]"
	exit()
else:
	db = sys.argv[1]

reader1 = vtkXMLTreeReader()
reader1.SetFileName(db)
reader1.Update()

dummy = vtkIcicleView()
view = vtkIcicleView()
view.SetRepresentationFromInput(reader1.GetOutput())
view.SetAreaSizeArrayName("size")
view.SetAreaColorArrayName("level")
view.SetAreaLabelArrayName("name")
view.SetAreaLabelVisibility(True)
view.SetAreaHoverArrayName("name")
#view.SetShrinkPercentage(0.05)
view.Update()

# Apply a theme to the views
theme = vtkViewTheme.CreateMellowTheme()
view.ApplyViewTheme(theme)
theme.FastDelete()

win = vtkRenderWindow()
dummy.SetupRenderWindow(win)
view.SetupRenderWindow(win)
view.Update()
view.GetRenderer().ResetCamera()

win.GetInteractor().Initialize()
win.GetInteractor().Start()
